<?php

/**
 * Albireo Kernel
 *
 * @copyright  Copyright (c) 2010 Albireo Solutions
 * @package    Kernel
 */

namespace ApiModule;

use ApiModule\BasePresenter;
use Nette\Application\Presenter;

/**
 * Rest presenter.
 * Does not have to check parameters
 * rpcManagement have to take care of it
 *
 * This API supports DELETE, PUT also but you can work only with GET or POST if you need by specifying actions
 * @author     petr
 * @package    Api
 */
//TODO: permissions to access API based on applications table
//TODO: react to PUT, DELETE headers, data type could be set by suffix (for example copy.json or copy.xml)
class OAuthPresenter extends BasePresenter {

    private $oauth;

    public function startup() {
        parent::startup();
        $this->oauth = new OAuthAccess();
        $this->view = "oauth";
    }

    public function actionRequest() {
        $this->template->token = $this->oauth->generateRequest();
    }

    public function actionAccess() {
        $this->template->token = $this->oauth->generateAccess();
    }
}